var api = require('../../utils/api.js');
var app = getApp();


Page({

  /**
   * 页面的初始数据
   */
  data: {
    show:'-1'
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    var that=this;
      api.get({
        url: 'wxapp/index/getallteam',
        data: {},
        success: data => {
           console.log(data);
           that.setData({
             banner:data.data
           })
        }
      });
  },

  getone(ret){
    console.log(ret);

    var id=ret.currentTarget.dataset.id;
    this.setData({
        show:id
    })

  },

  xuanzhe(){

    var id=this.data.show;
    var that=this;

    console.log(id);

    if  (id<1){
        wx.showToast({
            title: '请选择团队',
            icon:'none'
            })
            return false;
    }   

    api.get({
        url: 'wxapp/user/bandteam',
        data: {id:id},
        success: data => {
           console.log(data);

           wx.showToast({
             title: data.msg,
             icon:'none'
           })

           setTimeout(function(){
            wx.switchTab({
                url: '/pages/index/index',
              })
           },1200)
  
          
        }
      });
    
 
},
    



  
})